<?php
header("Content-Type:text/html;charset=utf-8");
$mysql = new SaeMysql(); //new一个mysql操作数据库类
//$mysql->runSql("delete from user"); //mysq删除数据语句
$sql = "SELECT * FROM user LIMIT 100"; //mysql查询语句
$data = $mysql->getData( $sql ); //执行查询语句并返回结果到变量$data
//$sql = "INSERT  INTO `user` ( `userName`, `password`) VALUES ('cowely' , '123456' ) "; //mysql插入语句
//$mysql->runSql($sql); //执行插入语句。增 删 改 都用这个方法执行。
  
for($i=0;$i<count($data);$i++)  //循环便利显示查询结果
{  
    echo "用户:".$data[$i]['userName']."    "."密码:".$data[$i]['password']."<br>";  
}  

$access_token='12345';
$time=666;
$sql = sprintf("update `tb_access_token`  set access_token='%s', expire_time=%d",$access_token,$time);
$mysql->runSql($sql); 

if ($mysql->errno() != 0) //如果有错误进行提示.
{
    die("Error:" . $mysql->errmsg());
}
else
{
echo "连接成功!";
}
$mysql->closeDb(); //关闭连接。
?>